package com.xmmj.main.model

import com.xmmj.baselibrary.network.RetrofitUtil.getService
import com.xmmj.main.bean.VideoBean
import com.xmmj.baselibrary.base.activity.mvvm.BaseModel
import com.xmmj.main.bean.TokenBean
import retrofit2.http.Field

class MainModel : BaseModel() {
    var api = getService(MainApi::class.java)

    suspend fun getVideos(
        page: Int,
        pageSize: Int,
        category: Int
    ): List<VideoBean> {
        return request {
            api.getVideos(
                page,
                pageSize,
                category
            )
        }
    }

    suspend fun login(
        username: String,
        password: String
    ): TokenBean {
        return request {
            api.login(
                username,
                password
            )
        }
    }
}